home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 039a / soundhax.zip / EXCEPT.C < prev    next >
C/C++ Source or Header  |  1991-12-19  |  3KB  |  158 lines

  1. /*-------------------------------------------------------*/
  2. /* Originally part of SOUNDHAX v1 by John M. Trindle     */
  3. /*                 FREEWARE 12/19/91                     */
  4. /*-------------------------------------------------------*/
  5.  
  6. #include <stdio.h>
  7. #include <stdlib.h>
  8.  
  9.  
  10. #define  CMS_AVAILABLE  1
  11. #define  FM_AVAILABLE   2
  12. #define  CV_AVAILABLE   4
  13.  
  14. #define  OFF            0
  15. #define  ON             1
  16.  
  17. #define  FALSE          0
  18. #define  TRUE           1
  19.  
  20. extern ct_io_addx;
  21. extern ct_int_num;
  22. extern ct_voice_status;
  23. extern ct_music_status;
  24.  
  25. static int StatusWord;
  26.  
  27. char *VoiceDriver;
  28.  
  29. /* Disables Text Driver!! 
  30.    sbts_unload();
  31. */
  32.  
  33. /* Says ASCIIZ string in buffer 
  34.       sbts_say(buffer);
  35. */
  36.  
  37. typedef struct
  38. {
  39.    char length;
  40.    char Text[255];
  41. } WordString;
  42.  
  43. extern int sbts_parser(char *buffer1, char *buffer2, int p1);
  44.  
  45. main(int argc, char *argv[])
  46. {
  47.    int DriverFeatures,VersionCode,RetVal;
  48.  
  49.    int gender,tone,volume,pitch,speed,i,j;
  50.    char buffer[255],buffer2[255],*TempPtr;
  51.  
  52.    char AsciiText[255],Phonetic[255];
  53.  
  54.    FILE *DictFP,*ExceptFP,*GoodFP,*RemainFP;
  55.  
  56.    WordString SubWord;
  57.  
  58.    DictFP = fopen("dict.sbt","r");
  59.    ExceptFP = fopen("dict.exc","wa");
  60.    RemainFP = fopen("dict.rem","wa");
  61.    GoodFP = fopen("dict.acc","wa");
  62.  
  63.  
  64.    ct_io_addx = 0x220;    /* I/O Base */
  65.  
  66.    DriverFeatures = ct_card_here();
  67.  
  68.    if (DriverFeatures & CMS_AVAILABLE)
  69.       printf("C/MS Music Available\n");
  70.  
  71.    if (DriverFeatures & FM_AVAILABLE)
  72.       printf("FM Music Available\n");
  73.  
  74.    if (DriverFeatures & CV_AVAILABLE)
  75.       printf("Creative Voice Available\n");
  76.    else
  77.    {
  78.       printf("Sound Blaster or Compatible NOT detected\n");
  79.       exit(1);
  80.    }
  81.  
  82.  
  83.    VersionCode = sbc_version();
  84.    printf("SBV Version = %d.%d\n",VersionCode >> 8, VersionCode & 0xff);
  85.  
  86.    sbc_scan_int();
  87.  
  88.    printf("Interrupt = %d\n",ct_int_num);
  89.  
  90.    RetVal = ctvd_init(6);
  91.    printf("ctvd_init = RetVal = %d\n",RetVal);
  92.  
  93.    RetVal = sbts_init();
  94.    printf("Init RetVal = %d\n",RetVal);
  95.  
  96.    gender = 1;
  97.    tone = 3;
  98.    volume = 13;
  99.    pitch = 8;
  100.    speed = 8;
  101.  
  102.    /* _sbts(gender,tone,volume,pitch,speed) */
  103.  
  104.  
  105.    while(fgets(buffer,254,DictFP)!=NULL)
  106.    {  
  107. top_loop:
  108.       printf("%s\n",buffer);
  109.       sscanf(buffer,"%s %s",AsciiText,Phonetic);
  110.       printf("%s\n",AsciiText);
  111.       printf("%s\n",Phonetic);
  112.       sbts_dict_ins(AsciiText,Phonetic);
  113.       sbts_say(AsciiText);
  114.       delay(2000);
  115.       sbts_dict_del(AsciiText);
  116.       if (kbhit())
  117.          i = getch();
  118.       else
  119.          i = 0;
  120.       switch(i)
  121.       {
  122.          case 'E':
  123.          case 'e':
  124.             fprintf(ExceptFP,"%-30s %s\n",AsciiText,Phonetic);
  125.             break;
  126.  
  127.          case 'H':
  128.          case 'h':
  129.             fprintf(RemainFP,"%-30s %s\n",AsciiText,Phonetic);
  130.             break;
  131.  
  132.          case 'a':
  133.          case 'A':
  134.             goto top_loop;
  135.  
  136.          case 0x1b:
  137.             break;
  138.  
  139.          default:
  140.             fprintf(GoodFP,"%-30s %s\n",AsciiText,Phonetic);
  141.             break;
  142.  
  143.       }
  144.       if (i == 0x1b)
  145.           break;
  146.    }
  147.    while(fgets(buffer,254,DictFP)!=NULL)
  148.    {
  149.       fprintf(RemainFP,"%s",buffer);
  150.    }
  151.    fclose(DictFP);
  152.    fclose(ExceptFP);
  153.    fclose(RemainFP);
  154.    ctvd_speaker(OFF);
  155.  
  156.    ctvd_terminate();
  157. }
  158.